package com.elm_springboot_s.service.impl;

import com.elm_springboot_s.mapper.DeliveryAddressMapper;
import com.elm_springboot_s.pojo.DeliveryAddress;
import com.elm_springboot_s.service.DeliveryAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeliveryAddressServiceImpl implements DeliveryAddressService {

    @Autowired
    private DeliveryAddressMapper deliveryAddressMapper;

    @Override
    public List<DeliveryAddress> listDeliveryAddressByUserId(Long userId) {
        return deliveryAddressMapper.listDeliveryAddressByUserId(userId);
    }

    @Override
    public DeliveryAddress getDeliveryAddressById(Integer daId) {
        return deliveryAddressMapper.getDeliveryAddressById(daId);
    }

    @Override
    public int saveDeliveryAddress(String contactName, Integer contactSex, String contactTel, 
                                 String address, Long userId) {
        return deliveryAddressMapper.saveDeliveryAddress(contactName, contactSex, contactTel, 
                                                       address, userId);
    }

    @Override
    public int updateDeliveryAddress(Integer daId, String contactName, Integer contactSex, 
                                   String contactTel, String address, Long userId) {
        return deliveryAddressMapper.updateDeliveryAddress(daId, contactName, contactSex, 
                                                         contactTel, address, userId);
    }

    @Override
    public int removeDeliveryAddress(Integer daId) {
        return deliveryAddressMapper.removeDeliveryAddress(daId);
    }
} 